﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using EIS.ClientUtility;
using EIS.Obj;
using EIS.ServerAdapter;

namespace EIS.ClientRoutineJob
{
    public class HeartBeat
    {

        public bool HeartBeatRequest()
        {
            try
            {

            
            //Send HeartBeat Request To Server
            string url = GlobalVariable.Instance.ServerRootURL;

            url = url + @"heartBeat" + @"/" + GlobalVariable.Instance.CurrentToken;
            DataSet dsHeartBeat = RestAdapter.HttpGet(url);
            return dsHeartBeat.Tables[0].Rows[0]["TimeOut"].ToString().ToUpper() == "FALSE";
            }
            catch (Exception ex)
            {
                ShowErrorMessageBox.Show(ex.InnerException == null ? ex.Message : ex.InnerException.Message);

                return false;
            }

        }
    }
}
